package cn.linjianhui.article.controller;

import cn.linjianhui.article.model.*;
import cn.linjianhui.article.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    ArticleService articleService;

    @PostMapping("/search")
    public CommonResult<PageData<Article>> search(@RequestBody ArticlePageQuery query) {
        return CommonResult.success(articleService.search(query));
    }

    @PostMapping("/detail")
    public CommonResult<ArticleDetail> detail(@RequestParam long id) {
        return CommonResult.success(articleService.getDetail(id));
    }
}
